package us.gaaoc.framework.model;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * Person Mapping for use with Hibernate abstraction layer
 */

public class Person implements java.io.Serializable {

	// Fields

	private String uuid;
	private String userId;
	private String password;
	private String firstName;
	private String middleName;
	private String lastName;
	private String suffixName;
	private Date dob;
	private byte changePwdFlag;
	private byte deleteUserFlag;
	private String email;

	private Profile profile;

	private Attorney attorney;
	private Judge judge;
	private Sheriff sheriff;

	private List<PersonParticipants> personParticipants;

	private Set documents;
	private Set notifications;

	// one-to-many association with address
	private List<PersonAddress> addresses;
	private List<CaseRecordHistory> caseRecordHistoryEntries;
	private List<CourtEvents> courtEventEntries;

	// many-to-many associations
	private List<PersonOrganizations> organizations;
	private List<Roles> roles;
	private boolean setCivilActionNumber;
	private boolean setCourtDate;
	
	private boolean canEdit;
	
	private SignatureImage signatureImage;

	// Constructors

	/** default constructor */
	public Person() {
	}

	/** constructor with id */
	public Person(String uuid) {
		this.uuid = uuid;
	}

	public Person(String firstName, String lastName) {
		this.setFirstName(firstName);
		this.setLastName(lastName);
	}

	// Property accessors

	public String getUuid() {
		return this.uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getUserId() {
		return this.userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public byte getChangePwdFlag() {
		return this.changePwdFlag;
	}

	public void setChangePwdFlag(byte changePwdFlag) {
		this.changePwdFlag = changePwdFlag;
	}

	public List<PersonParticipants> getPersonParticipants() {
		return this.personParticipants;
	}

	public void setPersonParticipants(List<PersonParticipants> participantses) {
		this.personParticipants = participantses;
	}

	public Set getDocuments() {
		return this.documents;
	}

	public void setDocuments(Set documentses) {
		this.documents = documentses;
	}

	public Set getNotifications() {
		return this.notifications;
	}

	public void setNotifications(Set notificationses) {
		this.notifications = notificationses;
	}

	public List<PersonOrganizations> getOrganizations() {
		return organizations;
	}

	public void setOrganizations(List<PersonOrganizations> organizations) {
		this.organizations = organizations;
	}

	public List<Roles> getRoles() {
		return roles;
	}

	public void setRoles(List<Roles> roles) {
		this.roles = roles;
	}

	public Profile getProfile() {
		return profile;
	}

	public void setProfile(Profile profile) {
		this.profile = profile;
	}

	/**
	 * @return Returns the addresses.
	 */
	public List<PersonAddress> getAddresses() {
		return addresses;
	}

	/**
	 * @param addresses
	 *            The addresses to set.
	 */
	public void setAddresses(List<PersonAddress> addresses) {
		this.addresses = addresses;
	}

	/**
	 * @return Returns the middleName.
	 */
	public String getMiddleName() {
		return middleName;
	}

	/**
	 * @param middleName
	 *            The middleName to set.
	 */
	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}

	/**
	 * @return Returns the suffixName.
	 */
	public String getSuffixName() {
		return suffixName;
	}

	/**
	 * @param suffixName
	 *            The suffixName to set.
	 */
	public void setSuffixName(String suffixName) {
		this.suffixName = suffixName;
	}

	/**
	 * @return Returns the attorney.
	 */
	public Attorney getAttorney() {
		return attorney;
	}

	/**
	 * @param attorney
	 *            The attorney to set.
	 */
	public void setAttorney(Attorney attorney) {
		this.attorney = attorney;
	}

	/**
	 * @return Returns the judge.
	 */
	public Judge getJudge() {
		return judge;
	}

	/**
	 * @param judge
	 *            The judge to set.
	 */
	public void setJudge(Judge judge) {
		this.judge = judge;
	}

	/**
	 * @return Returns the sheriff.
	 */
	public Sheriff getSheriff() {
		return sheriff;
	}

	/**
	 * @param sheriff
	 *            The sheriff to set.
	 */
	public void setSheriff(Sheriff sheriff) {
		this.sheriff = sheriff;
	}

	/**
	 * @return Returns the deleteUserFlag.
	 */
	public byte getDeleteUserFlag() {
		return deleteUserFlag;
	}

	/**
	 * @param deleteUserFlag
	 *            The deleteUserFlag to set.
	 */
	public void setDeleteUserFlag(byte deleteUserFlag) {
		this.deleteUserFlag = deleteUserFlag;
	}

	/**
	 * @return the dob
	 */
	public Date getDob() {
		return dob;
	}

	/**
	 * @param dob
	 *            the dob to set
	 */
	public void setDob(Date dob) {
		this.dob = dob;
	}

	/**
	 * @return the caseRecordHistoryEntries
	 */
	public List<CaseRecordHistory> getCaseRecordHistoryEntries() {
		return caseRecordHistoryEntries;
	}

	/**
	 * @param caseRecordHistoryEntries
	 *            the caseRecordHistoryEntries to set
	 */
	public void setCaseRecordHistoryEntries(
			List<CaseRecordHistory> caseRecordHistoryEntries) {
		this.caseRecordHistoryEntries = caseRecordHistoryEntries;
	}

	/**
	 * @return the courtEventEntries
	 */
	public List<CourtEvents> getCourtEventEntries() {
		return courtEventEntries;
	}

	/**
	 * @param courtEventEntries
	 *            the courtEventEntries to set
	 */
	public void setCourtEventEntries(List<CourtEvents> courtEventEntries) {
		this.courtEventEntries = courtEventEntries;
	}
	
	@Override
	public String toString() {
		return String.format("Person uuid:%s userid:%s name:%s %s",
			this.getUuid(),
			this.getUserId(),
			this.getFirstName(),
			this.getLastName());			
	}

	public boolean isSetCivilActionNumber() {
		return setCivilActionNumber;
	}

	public void setSetCivilActionNumber(boolean setCivilActionNumber) {
		this.setCivilActionNumber = setCivilActionNumber;
	}

	public boolean isSetCourtDate() {
		return setCourtDate;
	}

	public void setSetCourtDate(boolean setCourtDate) {
		this.setCourtDate = setCourtDate;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public SignatureImage getSignatureImage() {
		return signatureImage;
	}

	public void setSignatureImage(SignatureImage signatureImage) {
		this.signatureImage = signatureImage;
	}

	public boolean isCanEdit() {
		return canEdit;
	}

	public void setCanEdit(boolean canEdit) {
		this.canEdit = canEdit;
	}
	
	public void onPersonEdit(String edit){
		setCanEdit(Boolean.parseBoolean(edit));
	 }
	
	

	
}